package com.tdd;

import java.util.ArrayList;

public class CompositeOperation implements Operation {
	ArrayList<Operation> operations = new ArrayList<Operation>();

	public void operate(HpStack values) {
		for (Operation current : operations)
			current.operate(values);
	}

	public void add(Operation operation) {
		if (operation instanceof CompositeOperation) {
			if (operation == this)
				throw new NotADag();
		}
		operations.add(operation);

	}

}
